CentOS 7
Sponsored Link

MRTG : Get Memory Usage
2015/06/16
 
Configure MRTG to display Memory Usage rate.
[1] Configure MRTG.
# make sure total memory

[root@dlp ~]#
free

              total        used        free      shared  buff/cache   available
Mem:        4047620      263968     3336184       17476      447468     3560284
Swap:       3145724           0     3145724

[root@dlp ~]#
vi /etc/mrtg/mrtg.cfg
# add follows to the end (replace the "Serverworld" to your comunity name)

Target[mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.4.0:Serverworld@127.0.0.1:::::2
# total memory

MaxBytes1[Mem]: 4047620
# total swap

MaxBytes2[Mem]: 3145724
Unscaled[Mem]: dwmy
Options[Mem]: gauge, growright
YLegend[Mem]: Mem Free(Bytes)
ShortLegend[Mem]: Bytes
kilo[Mem]: 1024
kMG[Mem]: k,M,G,T,P
LegendI[Mem]: Real
LegendO[Mem]: Swap
Legend1[Mem]: Memory Free [MBytes]
Legend2[Mem]: Swap Free [MBytes]
Title[Mem]: Memory Free
PageTop[Mem]: <H1>Memory Free</H1>

# execute mrtg 3 times (display warnings until 3 times)

[root@dlp ~]#
for (( i=1 ; i <= 3 ; i++ )); do env LANG=C mrtg /etc/mrtg/mrtg.cfg; done

2015-06-16 19:26:12, Rateup WARNING: /usr/bin/rateup could not read the primary log file for mem
2015-06-16 19:26:12, Rateup WARNING: /usr/bin/rateup The backup log file for mem was invalid as well
2015-06-16 19:26:12, Rateup WARNING: /usr/bin/rateup Can't rename mem.log to mem.old updating log file
# generate index file

[root@dlp ~]#
indexmaker --columns=1 /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.html
[2] Access to the "http://(MRTG hostname or IP address)/mrtg/" from a client with HTTP, then it's possible to see Memory Usage rate.
 
Tweet